#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: v2tmf_settings.py 
@version:
@time: 2022/04/22 
"""
import json

from TapClientCore.T02_tm_api.v2_api.v2_tm import v2tm as TM
from TapUtil.logfunc.logger import logger


class V2TMFSettings:

    @staticmethod
    def _get_settings():
        return TM.get_settings()

    def get_tapdata_version(self):
        """
        获取tapdata 的version
        :return:
        """
        response = self._get_settings().get('data')
        for info in response:
            if info.get('key') == 'version':
                version = json.loads(info.get('value')).get('version')
                logger.info(f"version: {version}")
                return version
